package cn.wgx.security.service;

import cn.wgx.security.entity.User;
import cn.wgx.security.mapper.UserMapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

@Service
public class UserService extends ServiceImpl<UserMapper, User> {

    public User getUserByName(String username){
        User user = new User();
        user.setUsername(username);
        QueryWrapper<User> queryWrapper = new QueryWrapper<>(user);
        queryWrapper.last("LIMIT 1");
        User one = getOne(queryWrapper);
        return one;
    }


}
